package by.kniazhych.core.data {
	
	/**
	 * ...
	 * @author Boutylin Mikhail
	 */
	
		import by.kniazhych.core.events.ApplicationEvent;
		import by.vaukalak.core.data.DataBase;
		import flash.media.SoundMixer;
		import flash.media.SoundTransform;
	

	
	[Event(name="frameChanged", type="by.kniazhych.core.events.ApplicationEvent")]
	public class ApplicationDataBase extends DataBase{
		
		private var _currentApplicationFrame:String;
		private var _soundIsPlaying:Boolean = true;
		
		public function ApplicationDataBase() {
			super();			
		}
		
		//--------------------------------------------------------------------------
		//
		//  PROPERTIE ACSESSORS
		//
		//--------------------------------------------------------------------------
		
		public function get currentApplicationFrame():String { return _currentApplicationFrame; }
		
		public function set currentApplicationFrame(value:String):void {
			_currentApplicationFrame = value;
			dispatchEvent(new ApplicationEvent(ApplicationEvent.FRAME_CHANGED, value, true, false));
		}
		
		public function get soundIsPlaying():Boolean { return _soundIsPlaying; }
		
		public function togleSound():void {
			_soundIsPlaying = !_soundIsPlaying;
			SoundMixer.soundTransform = new SoundTransform(_soundIsPlaying ? 1 : 0);
		}
		
	}

}